package com.neshai.webapp.config;

import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.stereotype.Component;

@Component
public class DelayedTaskConfig {

    @Bean
    public ThreadPoolTaskScheduler taskScheduler() {
        ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
        scheduler.setPoolSize(10); // 设置线程池大小，可以根据需求调整
        scheduler.setThreadNamePrefix("TaskScheduler-");
        scheduler.initialize(); // 初始化
        return scheduler;
    }
}